package com.zut.controller.house;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zut.service.HouseService;
import com.zut.service.impl.HouseServiceImpl;
import com.zut.utils.LimitUtil;

/**
 * Servlet implementation class findHouseServlet
 */
@WebServlet("/findHouseServlet")
public class findHouseServlet extends HttpServlet {
	HouseService hService = new HouseServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//System.out.println(request.getParameter("currentPage"));
		int currentPage = Integer.parseInt(request.getParameter("currentPage"));
		//int currentPage = 1;
		//System.out.println("========findHouseServlet===currentPage="+currentPage);
		LimitUtil limitUtil = hService.getData(currentPage);
		request.setAttribute("pageBean", limitUtil);
		
		request.getRequestDispatcher("/view/flats/list.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
